//2009/08/19 16:58:38
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class EratosthenSieve2
{
public:
    int nthElement(int n)
    {
        vector<int> v;
        for (int i=1; i<=1000; i++) v.push_back(i);
        for (int i=2; i<=10; i++)
        {
            for (int j=i-1; j<v.size(); j+=i)  v[j] = -1;
            for (int j=0; j<v.size();)
                if (v[j]==-1) v.erase(v.begin()+j);
                else j++;
        }
		return v[n-1];
    }
};
